﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TCC.DTO;

namespace TCC.MasterPage
{
    public partial class MPage : System.Web.UI.MasterPage
    {
        public DtoUsuario Usuario
        {
            get { return (DtoUsuario)(Session["Usr"]); }
            set { Session["Usr"] = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            InicializaLogonArea();
        }

        protected void InicializaLogonArea()
        {
            if (Usuario == null)
                divLogar.Visible = true;
            else
            {
                divLogar.Visible = false;
                lblUsuario.Text = Usuario.Nome;
            }

            divLogado.Visible = !divLogar.Visible;
        }

        protected void lnkLogof_Click(object sender, EventArgs e)
        {
            Usuario = null;

            Response.Redirect("generic.aspx");
        }
    }
}